//
//  BMAEmotionViewController.m
//  Autismus
//
//  Created by Salhi yacine on 04/12/11.
//  Copyright (c) 2011 EPITECH. All rights reserved.
//

#import "BMAEmotionViewController.h"

@implementation BMAEmotionViewController

@synthesize backButton;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];    
}

-(IBAction)goBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)pressEmotion:(UIButton *)b
{
    switch (b.tag) {
        case BMAEmotionEnColere:
        {
            break;
        }

        case BMAEmotionEffraye:
        {
            break;
        }

        case BMAEmotionJoyeux:
        {
            UIImageView *animViewController = [[UIImageView alloc] init];
            NSArray *animImg = [NSArray arrayWithObjects:[UIImage imageNamed:@"illustration-joyeux-grand_01.png"],
              [UIImage imageNamed:@"illustration-joyeux-grand_02.png"],
              [UIImage imageNamed:@"illustration-joyeux-grand_03.png"],
              [UIImage imageNamed:@"illustration-joyeux-grand_04.png"],
              nil];
            animViewController.animationImages = animImg;
            animViewController.animationDuration = 0.8;
            animViewController.animationRepeatCount = 3;
            animViewController.frame = CGRectMake(200, 70, 675, 614);
            [self.view addSubview:animViewController];
            [animViewController startAnimating];
            break;
        }

        case BMAEmotionTriste:
        {
            break;
        }
            
        case BMAEmotionEtonne:
        {
            break;
        }
            
        case BMAEmotionMalade:
        {
            break;
        }
    }
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    DLOG(@"self.backButton = %@", self.backButton);
    
    [self.backButton setImage:[[self.backButton imageForState:UIControlStateNormal] imageTintedWithColor:[UIColor blackColor] fraction:0.5] forState:UIControlStateNormal];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    self.backButton = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

@end
